/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */
var setZeroes = function(matrix) {
  let zeroRow = new Set(), zeroCol = new Set();
  for(let i = 0; i < matrix.length; i++) {
    for(let j = 0; j < matrix[0].length; j++) {
      if(!matrix[i][j]) {
        zeroRow.add(i);
        zeroCol.add(j);
      }
    }
  }
  let valuesRow = [...zeroRow], valuesCol = [...zeroCol];
  for(let i = 0; i < matrix.length; i++) {
    for(let j = 0; j < matrix[0].length; j++) {
      if(valuesRow.includes(i) || valuesCol.includes(j)) {
        matrix[i][j] = 0;
      }
    }
  }
  return matrix;
};
let matrix = [
  [1,1,1],
  [1,0,1],
  [1,1,1]
];
console.log(setZeroes(matrix));
matrix = [
  [0,1,2,0],
  [3,4,5,2],
  [1,3,1,5]
];
console.log(setZeroes(matrix));
